package experiment_seven;

// 抽象类 Animal
abstract class Animal {
    public abstract void cry();
    public abstract String getAnimalName();
}

// 子类 Dog
class Dog extends Animal {
    @Override
    public void cry() {
        System.out.println("汪汪！");
    }

    @Override
    public String getAnimalName() {
        return "狗";
    }
}

// 子类 Cat
class Cat extends Animal {
    @Override
    public void cry() {
        System.out.println("喵喵！");
    }

    @Override
    public String getAnimalName() {
        return "猫";
    }
}

// 模拟器类 Simulator
class Simulator {
    public void playSound(Animal animal) {
        System.out.print(animal.getAnimalName() + "的叫声是：");
        animal.cry();
    }
}

// 主类 Application
public class experiment_seven {
    public static void main(String[] args) {
        Simulator simulator = new Simulator();
        simulator.playSound(new Dog());
        simulator.playSound(new Cat());
    }
}
